package com.fourhats.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fourhats.services.ItemService;
import com.fourhats.services.dto.ItemDto;

@Controller
public class ItemController {

	@Autowired
	private ItemService itemService;
	
	@RequestMapping(value = "/item/getItemsByKeyword", 
	method = RequestMethod.GET, 
	headers="Accept=*/*")
	public @ResponseBody List<ItemDto> getItemsByKeyword(@RequestParam("term") String keyword){
		List<ItemDto> items = this.itemService.getItemsByKeyword(keyword);
		return items;
	}
}